package com.axzhengxin.platform.afterloan.controller;

import com.axzhengxin.platform.afterloan.domain.FspBizApproveInfo;
import com.axzhengxin.platform.afterloan.service.IAfterLoanBizInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * AfterLoanBizApproveInfoController
 * 贷后未到期授信信息查询接口
 *
 * @author jiangnan
 * @date 2021/3/3
 */
@Slf4j
@RestController
@RequestMapping(path = "/afterloan")
public class AfterLoanBizApproveInfoController extends BaseController {

    private IAfterLoanBizInfoService fspBizInfoService;

    public AfterLoanBizApproveInfoController(IAfterLoanBizInfoService fspBizInfoService) {
        this.fspBizInfoService = fspBizInfoService;
    }

    /**
     * 查询未过期授信信息
     * 与当前用户所属机构或下级任意机构发生业务的客户的，全部由上述范围内机构办理的授信
     *
     * @param fspBizApproveInfo 查询参数
     * @return 查询结果集合
     */
    /*@PreAuthorize("@ss.hasPermi('afterloan:unexpiredapprove:list')")*/
    @GetMapping(path = "/unexpiredapprove/list")
    public TableDataInfo unexpiredList(FspBizApproveInfo fspBizApproveInfo) {
        startPage();
        fspBizApproveInfo.setExpired(Boolean.FALSE);
        List<FspBizApproveInfo> fspBizApproveInfoList = fspBizInfoService.selectBizApproveInfoUnexpiredList(fspBizApproveInfo);
        return getDataTable(fspBizApproveInfoList);
    }

    /**
     * 查询所有授信信息
     * 与当前用户所属机构或下级任意机构发生业务的客户的，全部由上述范围内机构办理的授信
     *
     * @param fspBizApproveInfo 查询参数
     * @return 查询结果集合
     */
    /*@PreAuthorize("@ss.hasPermi('afterloan:allapprove:list')")*/
    @GetMapping(path = "/allapprove/list")
    public TableDataInfo allList(FspBizApproveInfo fspBizApproveInfo) {
        startPage();
        List<FspBizApproveInfo> fspBizApproveInfoList = fspBizInfoService.selectAllBizApproveInfoList(fspBizApproveInfo);
        return getDataTable(fspBizApproveInfoList);
    }

}
